/* 
 * File:   BoundingBox.h
 * Author: brady
 *
 * Created on June 20, 2011, 7:15 PM
 */

#ifndef BOUNDINGBOX_H
#define	BOUNDINGBOX_H
#include <core/Vector3D.h>
#include <dto/IntersectionParams.h>
#include <float.h>
#include <algorithm>

using namespace std;
class BoundingBox {
public:
    BoundingBox();
    BoundingBox(const Vector3D& min, const Vector3D& max);
    BoundingBox(const BoundingBox& orig);
    virtual ~BoundingBox();
    void pad(double amount);
    bool testIntersect(IntersectionParams& ip, double* t_enter, double* t_exit) const ;
    bool contains(const Vector3D& point);
    bool overlaps(const BoundingBox& box) const;
    BoundingBox encompass(const BoundingBox& childBoundingBox);
    const Vector3D& getMax() const;
    const Vector3D& getMin() const;
    const Vector3D& getCenter() const;
    void setMax(const Vector3D& max);
    void setMin(const Vector3D& min);
    const static BoundingBox inverseBox(){return BoundingBox(Vector3D(DBL_MAX, DBL_MAX, DBL_MAX), Vector3D(DBL_MIN, DBL_MIN, DBL_MIN));}
private:
    Vector3D minCorner;
    Vector3D maxCorner;
    Vector3D center;

};

#endif	/* BOUNDINGBOX_H */

